package com.ruoyi.consumer.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.consumer.mapper.CUnitPriceMapper;
import com.ruoyi.consumer.domain.CUnitPrice;
import com.ruoyi.consumer.service.ICUnitPriceService;

/**
 * 单价Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-10-29
 */
@Service
public class CUnitPriceServiceImpl implements ICUnitPriceService 
{
    @Autowired
    private CUnitPriceMapper cUnitPriceMapper;

    /**
     * 查询单价
     * 
     * @param unitId 单价主键
     * @return 单价
     */
    @Override
    public CUnitPrice selectCUnitPriceByUnitId(Integer unitId)
    {
        return cUnitPriceMapper.selectCUnitPriceByUnitId(unitId);
    }

    /**
     * 查询单价列表
     * 
     * @param cUnitPrice 单价
     * @return 单价
     */
    @Override
    public List<CUnitPrice> selectCUnitPriceList(CUnitPrice cUnitPrice)
    {
        return cUnitPriceMapper.selectCUnitPriceList(cUnitPrice);
    }

    /**
     * 新增单价
     * 
     * @param cUnitPrice 单价
     * @return 结果
     */
    @Override
    public int insertCUnitPrice(CUnitPrice cUnitPrice)
    {
        cUnitPrice.setCreateTime(DateUtils.getNowDate());
        return cUnitPriceMapper.insertCUnitPrice(cUnitPrice);
    }

    /**
     * 修改单价
     * 
     * @param cUnitPrice 单价
     * @return 结果
     */
    @Override
    public int updateCUnitPrice(CUnitPrice cUnitPrice)
    {
        cUnitPrice.setUpdateTime(DateUtils.getNowDate());
        return cUnitPriceMapper.updateCUnitPrice(cUnitPrice);
    }

    /**
     * 批量删除单价
     * 
     * @param unitIds 需要删除的单价主键
     * @return 结果
     */
    @Override
    public int deleteCUnitPriceByUnitIds(Integer[] unitIds)
    {
        return cUnitPriceMapper.deleteCUnitPriceByUnitIds(unitIds);
    }

    /**
     * 删除单价信息
     * 
     * @param unitId 单价主键
     * @return 结果
     */
    @Override
    public int deleteCUnitPriceByUnitId(Integer unitId)
    {
        return cUnitPriceMapper.deleteCUnitPriceByUnitId(unitId);
    }
}
